﻿using System;
using System.ComponentModel;

namespace WWLauncher.Util
{
    public enum PowerPlugStatus { Online, Offline }

    public interface IPowerSchema : INotifyPropertyChanged
    {
        string Name { get; }
        Guid Guid { get; }
        bool IsActive { get; }
    }

    public class PowerSchema : INotifyPropertyChanged, IPowerSchema
    {
        public PowerSchema(string name, Guid guid) : this(name, guid, false) { }

        public PowerSchema(string name, Guid guid, bool isActive)
        {
            this.Name = name;
            this.Guid = guid;
            this.IsActive = isActive;
        }
        public Guid Guid { get; }

        string name;
        public string Name { get { return name; } set { if (name == value) { return; } name = value; OnPropertyChanged("Name"); } }

        bool isActive;
        public bool IsActive
        {
            get { return isActive; }
            set { if (isActive == value) { return; } isActive = value; OnPropertyChanged("IsActive"); }
        }


        public override string ToString()
        {
            return $"{Name}:{IsActive}";
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
